#Test script of Org Search
require File.dirname(__FILE__)+'/../lib//testdata/testdata.rb'
require File.dirname(__FILE__)+'/../lib/elements/Accounts/element_Accounts.rb'
require File.dirname(__FILE__)+'/../lib/reporting.rb'
require File.dirname(__FILE__)+'/../lib/std_lib.rb'
require 'watir'
require 'watir/testcase'

class Create_Accounts < Watir::TestCase
    OCRM_STD_LIB.login($stage,$username,$password)
    def test_setup
        
        #  $ie.bring_to_front
        filename  = File.basename(__FILE__).gsub(/\.rb/, "")
        @@account_name="Tonytest"
        @@search_in="Account Name"

        begin
            $log=Reporting.new(File.dirname(__FILE__)+'/../doc/report/ '"",filename)
          
        rescue
            puts $!
            puts $@
            $log.close unless $log.nil?
        end
    end
    def test_quick_create_usa
        #Quick Create account of Active.Com
        @@accountname = "Tonytest"+Time.now.strftime("%Y%m%d")
        Element::QuickCreateLinks.quick_create_account_link.click
        sleep 10
        $ie = Watir::IE.attach(:title,/Accounts/)
        Element::CreateAccounts.account_name_text_field.set(@@accountname + "_USA")
        Element::CreateAccounts.operating_unit_name_select_list.set("Active.Com")
        Element::CreateAccounts.operating_unit_id_select_list.set("86")
        Element::CreateAccounts.market_1_select_list.select("Campgrounds")
        Element::CreateAccounts.sub_market_1_select_list.set("Boat Licensing Departments")
        Element::CreateAccounts.market_priority_1_select_list.set("A")
        Element::CreateAccounts.market_status_1_select_list.set("Customer")
        Element::CreateAccounts.bill_to_country_select_list.set("USA")
        Element::CreateAccounts.bill_to_number_street_text_field.set("4570 Walnut Street")
        Element::CreateAccounts.bill_to_address_2_text_field.set("1 Test")
        Element::CreateAccounts.bill_to_city_text_field.set("Boulder")
        Element::CreateAccounts.bill_to_county_text_field.set("Boulder")
        Element::CreateAccounts.bill_to_state_select_list.set("CO")
        Element::CreateAccounts.bill_to_zip_text_field.set("80301")
        Element::CreateAccounts.save_button.click
    end
=begin
    def test_quick_create_can
        #Quick Creat account of CAD
        $ie = Watir::IE.attach(:title,"Accounts - Oracle CRM On Demand")
        $ie.bring_to_front
        Element::CreateAccounts.account_name_text_field.set("Tonytest_OCRM1356_CAN")
        Element::CreateAccounts.operating_unit_name_select_list.set("Canada Operating Unit")
        Element::CreateAccounts.operating_unit_id_select_list.set("97")
        Element::CreateAccounts.market_1_select_list.select("Campgrounds")
        Element::CreateAccounts.sub_market_1_select_list.set("Boat Licensing Departments")
        Element::CreateAccounts.market_priority_1_select_list.set("A")
        Element::CreateAccounts.market_status_1_select_list.set("Customer")
        sleep 5
        Element::CreateAccounts.bill_to_country_select_list.select("Canada")
        sleep 5
        Element::CreateAccounts.bill_to_number_street_text_field.set("111 Robson ST")
        Element::CreateAccounts.bill_to_address_2_text_field.set("1 Test")
        Element::CreateAccounts.bill_to_city_text_field.set("Vancouver")
        Element::CreateAccounts.bill_to_province_text_field.set("British Columbia")
        #Bugs about Select countries
        Element::CreateAccounts.bill_to_zip_text_field.set("V6G3H7")
        Element::CreateAccounts.save_button.click
    end
=end



    def test_reset

    end

    def test_tear_down
        @@for = nil
        @@search_in = nil
    end
end


class NewAccounts < Watir::TestCase
    def test_setup
    end

    def test_tear_down
        $log.close unless $log.nil?
    end
end